package com.zhuiyun.project.api.submitrecord.contorller;




import com.zhuiyun.project.api.submitrecord.entity.SubmitRecord;
import com.zhuiyun.project.api.submitrecord.service.ISubmitService;
import com.zhuiyun.project.common.response.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @BelongsProject: cp-springboot
 * @BelongsPackage: com.zhuiyun.project.api.record.controller
 * @ClassName SubmitController
 * @Author: xiaoyang
 * @CreateTime: 2024-08-12  19:44
 * @Description: TODO
 * @Version: 1.0
 */
@CrossOrigin
@RestController
@RequestMapping("/submit")
public class SubmitController {

   @Autowired
   private ISubmitService ISubmitService;

   /**
    * 提交记录
    * @param submit
    */
   @PostMapping
   public CommonResult saveSubmitRecord(@RequestBody SubmitRecord submit) {
     return ISubmitService.saveSubmitRecord(submit);
   }

   /**
    * 获取自己的提交记录
    * @return
    */
   @GetMapping("/getMySubmitRecord")
   public CommonResult getMySubmitRecord() {
      return ISubmitService.getMySubmitRecord();
   }
   /**
    * 获取提交记录
    * @return
    */
   @GetMapping("/getSubmitRecordByType")
   public CommonResult getSubmitRecordByType(Integer lotteryTypeIndex,Integer projectNameIndex,String lotteryNo) {
      return ISubmitService.getSubmitRecordByType(lotteryTypeIndex,projectNameIndex,lotteryNo);
   }
   /**
    * 获取提交记录
    * @return
    */
   @GetMapping("/getSubmitRecordByTypeAndToday")
   public CommonResult getSubmitRecordByTypeAndToday(Integer lotteryTypeIndex,Integer projectNameIndex,String lotteryNo) {
      return ISubmitService.getSubmitRecordByTypeAndToday(lotteryTypeIndex,projectNameIndex,lotteryNo);
   }
   /**
    * 查看用户的提交记录
    * @return
    */
   @GetMapping("/getSubmitRecordByPhoneAndType")
   public CommonResult getSubmitRecordByPhoneAndType(Integer lotteryTypeIndex,Integer projectNameIndex,String phoneNumber) {
      return ISubmitService.getSubmitRecordByPhoneAndType(lotteryTypeIndex,projectNameIndex,phoneNumber);
   }
   /**
    * 获取个人经验值
    * @return
    */
   @GetMapping("/getMyExperience")
   public CommonResult getMyExperience(){
      return ISubmitService.getMyExperience();
   }


   /**
    * @param submit  支付佣金
    * @return
    */
   @PostMapping("/payCommission")
   public CommonResult payCommission(@RequestBody SubmitRecord submit){
      return ISubmitService.payCommission(submit);
   }
}
